// app.js
import utils from './utils/utils.js'
import http from './utils/http.js'
// 挂载到全局对象 wx
// wx.utils = utils
wx.utils = Object.assign({}, wx.utils, utils)
wx.http = http
App({
  globalData: {},
  onLaunch() {
    console.log('小程序启动')
    // 读取本地存储的 token 数据
    this.getToken()
  },
  setToken(key, token) {
    // 将 token 记录在应用实例中
    this[key] = token,
    wx.setStorageSync(key, token)
  },
  getToken() {
    this.token = wx.getStorageSync('token')
    this.refreshToken = wx.getStorageSync('refreshToken')
  }
})